'''
Created on 11/06/2012

@author: rcasal
'''

if 0:
    None
    import gluon
    global db; db = gluon.sql.DAL()
    global dbDatosComunes; dbDatosComunes = gluon.sql.DAL()
    from gluon.dal import Field
    global DAL; DAL = gluon.dal()
    from gluon.validators import IS_IN_DB
    from gluon.validators import IS_EMPTY_OR
    from gluon.validators import IS_INT_IN_RANGE
    from gluon.validators import IS_LENGTH
    from gluon.validators import IS_IN_SET
    import gluon.languages.translator as T
    
class Consultante(object):
    '''
    classdocs
    '''

    table = None

    def __init__(self):
        '''
        Constructor
        '''
        self.table = DAL(None).define_table(
            'Consultantes', 
            Field('condicion', type = 'integer', label = "Condicion"),
            Field('empresa_prestador', type = 'string', label = "Empresa / Prestador"),
            Field('nombre', type = 'string', length = 50, requires=IS_EMPTY_OR(IS_LENGTH(50,1))),
            Field('apellido', type = 'string', length = 50, requires=IS_EMPTY_OR(IS_LENGTH(50,1))),
            Field('genero', type = 'string', length = 10, requires=IS_EMPTY_OR(IS_IN_SET(['Masculino', 'Femenino', 'Otro'],zero=T('choose one')))),
            Field('tipo_documento', type = 'integer', requires = IS_IN_DB(dbDatosComunes, 'CodTipoDocumento.id', '%(Codigo)s',orderby = 'CodTipoDocumento.Codigo',zero=T('choose one'))),
            Field('nro_documento', type = 'integer', requires=IS_EMPTY_OR(IS_INT_IN_RANGE(100, 99000000))),
            Field('cuit', type = 'string', length = 11, label='CUIT'),
            Field('cuil', type = 'string', length = 11, label='CUIL'),
            Field('telefono', type = 'integer'),
            Field('mail', type = 'string'),
        )
        self.table.condicion.requires = IS_IN_DB(dbSgc, 'Condiciones_Consultantes.id', '%(descripcion)s',orderby = 'Condiciones_Consultantes.descripcion ASC', zero=T('choose one'))
 
        